package com.gpframework.module.module.domain.req;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gpframework.common.utils.StringUtils;
import com.gpframework.module.base.domain.req.BaseReq;
import com.gpframework.module.module.domain.BrandInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * @ClassName BrandInfoReq
 * @Author gpframework
 * @Date 2022-03-23
 * @Version 1.0.0
 * @Description 列表查询信息体
 */
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
public class BrandInfoReq extends BaseReq {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键")
    private Long brandId;
    @ApiModelProperty("系统用户id")
    private Long brandUserId;
    @ApiModelProperty("区域id")
    private Long areaId;
    @ApiModelProperty("系统账号")
    private String userName;
    @ApiModelProperty("品牌编号")
    private String brandNo;
    @ApiModelProperty("品牌名称")
    private String brandName;
    @ApiModelProperty("品牌logo")
    private String brandLogo;
    @ApiModelProperty("品牌印章")
    private String brandSeal;
    @ApiModelProperty("营业执照")
    private String licenseImage;
    @ApiModelProperty("品牌地址")
    private String brandAddress;
    /**
     * 品牌经度
     */
    @ApiModelProperty("品牌经度")
    private String brandLongitude;
    /**
     * 品牌纬度
     */
    @ApiModelProperty("品牌纬度")
    private String brandLatitude;
    @ApiModelProperty("公司名称")
    private String companyName;
    @ApiModelProperty("公司网址")
    private String companyWebsite;
    @ApiModelProperty("公司介绍")
    private String companyIntroduce;
    @ApiModelProperty("邮箱")
    private String email;
    @ApiModelProperty("有效开始时间")
    private Date effTimeStart;
    @ApiModelProperty("有效结束时间")
    private Date effTimeEnd;
    @ApiModelProperty("手机号码")
    private String mobile;
    @ApiModelProperty("法人")
    private String leaderName;
    @ApiModelProperty("审核状态(1审核中、2审核通过、3不通过、4禁用)")
    private Integer auditStatus;
    @ApiModelProperty("平台销售id")
    private Long salesId;
    @ApiModelProperty("平台销售名称")
    private String salesName;
    @ApiModelProperty("排序")
    private Integer sort;
    @ApiModelProperty("备注")
    private String remarks;
    @ApiModelProperty("创建人")
    private String createBy;
    @ApiModelProperty("创建时间")
    private Date createTime;
    @ApiModelProperty("更新人")
    private String updateBy;
    @ApiModelProperty("更新时间")
    private Date updateTime;
    @ApiModelProperty("删除标识（0正常 1删除）")
    private Integer delStatus;

    /**
     * @Description 生成查询wrapper
     * @Author greatplan@qq.com
     * @Date 2020-11-04 16:04
     * @Param [lqw]
     * @Param [isVO] 是否vo查询体，true的话走的是mapper.xml里面的查询语句，不过查询语法还是mybatis-plus，主要用于某些关联查询出一些非数据表字段
     * @Return void
     */
    public void generatorQuery(QueryWrapper<BrandInfo> lqw, boolean isVo) {
        String alias = "";
        if (isVo) {
            alias = "gp.";
            lqw.eq(alias + "del_status", 0);
        }
        if (this.getBrandId() != null) {
            lqw.eq(alias + "brand_id", this.getBrandId());
        }
        if (this.getBrandUserId() != null) {
            lqw.eq(alias + "brand_user_id", this.getBrandUserId());
        }
        if (this.getAreaId() != null) {
            lqw.eq(alias + "area_id", this.getAreaId());
        }
        if (StringUtils.isNotBlank(this.getUserName())) {
            lqw.like(alias + "user_name", this.getUserName());
        }
        if (StringUtils.isNotBlank(this.getBrandNo())) {
            lqw.eq(alias + "brand_no", this.getBrandNo());
        }
        if (StringUtils.isNotBlank(this.getBrandName())) {
            lqw.like(alias + "brand_name", this.getBrandName());
        }
        if (StringUtils.isNotBlank(this.getBrandLogo())) {
            lqw.eq(alias + "brand_logo", this.getBrandLogo());
        }
        if (StringUtils.isNotBlank(this.getLicenseImage())) {
            lqw.eq(alias + "license_image", this.getLicenseImage());
        }
        if (StringUtils.isNotBlank(this.getBrandAddress())) {
            lqw.eq(alias + "brand_address", this.getBrandAddress());
        }
        if (StringUtils.isNotBlank(this.getCompanyName())) {
            lqw.like(alias + "company_name", this.getCompanyName());
        }
        if (StringUtils.isNotBlank(this.getCompanyWebsite())) {
            lqw.eq(alias + "company_website", this.getCompanyWebsite());
        }
        if (StringUtils.isNotBlank(this.getCompanyIntroduce())) {
            lqw.eq(alias + "company_introduce", this.getCompanyIntroduce());
        }
        if (this.getEmail() != null) {
            lqw.eq(alias + "email", this.getEmail());
        }
        if (this.getEffTimeStart() != null) {
            lqw.eq(alias + "eff_time_start", this.getEffTimeStart());
        }
        if (this.getEffTimeEnd() != null) {
            lqw.eq(alias + "eff_time_end", this.getEffTimeEnd());
        }
        if (StringUtils.isNotBlank(this.getMobile())) {
            lqw.eq(alias + "mobile", this.getMobile());
        }
        if (StringUtils.isNotBlank(this.getLeaderName())) {
            lqw.like(alias + "leader_name", this.getLeaderName());
        }
        if (this.getAuditStatus() != null) {
            lqw.eq(alias + "audit_status", this.getAuditStatus());
        }
        if (this.getSalesId() != null) {
            lqw.eq(alias + "sales_id", this.getSalesId());
        }
        if (StringUtils.isNotBlank(this.getSalesName())) {
            lqw.eq(alias + "sales_name", this.getSalesName());
        }
        if (this.getSort() != null) {
            lqw.eq(alias + "sort", this.getSort());
        }
        if (StringUtils.isNotBlank(this.getRemarks())) {
            lqw.eq(alias + "remarks", this.getRemarks());
        }
        if (StringUtils.isNotBlank(this.getCreateBy())) {
            lqw.eq(alias + "create_by", this.getCreateBy());
        }
        if (this.getCreateTime() != null) {
            lqw.eq(alias + "create_time", this.getCreateTime());
        }
        if (StringUtils.isNotBlank(this.getUpdateBy())) {
            lqw.eq(alias + "update_by", this.getUpdateBy());
        }
        if (this.getUpdateTime() != null) {
            lqw.eq(alias + "update_time", this.getUpdateTime());
        }
        if (this.getDelStatus() != null) {
            lqw.eq(alias + "del_status", this.getDelStatus());
        }
        lqw.orderByDesc(alias + "update_time");
        lqw.groupBy(alias + "brand_id");
    }
}
